<%--
  Created by IntelliJ IDEA.
  User: cos
  Date: 2022/3/9
  Time: 14:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
<form action="#">
    <input type="text" name="username" id="username">
    <input type="password" name="password">
    <input type="submit"/>
</form>
<script>
    $(function () {
        $("#username").change(function () {
            $.get("/ajax/checkUsername/"+$(this).val(),function (data) {
                if (data==1) {
                   alert("用户名存在");
                }else{
                    alert("用户名错误");
                }
            });
        })
    })
</script>
</body>
</html>
